﻿using System;
using System.Data;

namespace Fingerbrisk.DataSource.FluentDatasourceInteract
{
    /// <summary>
    /// Fluent Source
    /// Will provide implementation as 
    /// var source = FluentSource.QueryAs().Select("e.employeeName, e.age").From("Employee").As("e").Where("e.age > %s").And("e.firstName.StartsWith('%s')");
    /// var source = FluentSource.QueryAs().Select("e.employeeName, e.age").From("Employee").As("e").And("Department").As("d").With("e.departmentId in d.departmentId").Where("e.age > %s").And("e.firstName.StartsWith('%s')");
    /// var result = FluentSource.QueryAs(params args);
    /// </summary>
    public interface IFluentSource : IDisposable
    {
        ConnectionState State { get; }

        ITransaction NewTransaction();

        /// <summary>
        /// Expression that can be compiled to the query that could be executed on the underlying datasource
        /// </summary>
        IQueryExpression QueryAs();

        /// <summary>
        /// Expression that can be compiled to the query that could be executed on the underlying datasource
        /// </summary>
        IQueryExpression QueryWith(ITransaction transaction);
    }
}